﻿using System;
using System.Linq;
using System.ServiceModel.Activation;
using AgileDashboard.AppCode;

namespace AgileDashboard.services
{
    // NOTE: If you change the class name "UIData" here, you must also update the reference to "UIData" in Web.config.
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class UIData : IUIData
    {
        public TeamStatus GetTeamStatus(string iterationSchedule, string team)
        {
            var dao = new TeamStatusDao(new RestDataConnection());
            return dao.GetTeamStatus(iterationSchedule, team);
        }

        public TeamStatus[] GetMultiTeamStatus(string iterationSchedule, string[] teams)
        {
            var dao = new TeamStatusDao(new RestDataConnection());
            return teams.Select(team => dao.GetTeamStatus(iterationSchedule, team)).ToArray();
        }

        public Project[] GetMultiConfiguredReleaseStatus()
        {
            var dao = new ProjectDao(new RestDataConnection());
            return dao.GetAgileDashboardConfiguredProjects().ToArray();
        }
    }
}
